package service

import (
	"context"
	pb "gitee.com/micro-services/protocol/user/server"
	"micro.user.auth.server/ao"
	"micro.user.auth.server/utils"
)

type UserAuthControl struct{}

func (u *UserAuthControl) GenerateToken(ctx context.Context, r *pb.GenerateTokenReq, w *pb.GenerateTokenRsp) error {
	defer utils.Logf(ctx, "UserRegistry", r)(w)
	return ao.GenerateToken(ctx, r, w)
}

func (u *UserAuthControl) CheckToken(ctx context.Context, r *pb.CheckTokenReq, w *pb.CheckTokenRsp) error {
	defer utils.Logf(ctx, "CheckToken", r)(w)
	return ao.CheckToken(ctx, r, w)
}

func (u *UserAuthControl) ResolveToken(ctx context.Context, r *pb.ResolveTokenReq, w *pb.ResolveTokenRsp) error {
	defer utils.Logf(ctx, "ResolveToken", r)(w)
	return ao.ResolveToken(ctx, r, w)
}

func (u *UserAuthControl) CheckUserRole(ctx context.Context, r *pb.CheckUserRoleReq, w *pb.CheckUserRoleRsp) error {
	defer utils.Logf(ctx, "CheckUserRole", r)(w)
	return ao.CheckUserRole(ctx, r, w)
}

func (u *UserAuthControl) GetWxUserInfo(ctx context.Context, r *pb.GetWxUserInfoReq, w *pb.GetWxUserInfoRsp) error {
	defer utils.Logf(ctx, "GetWxUserInfo", r)(w)
	return ao.GetWxUserInfo(ctx, r, w)
}

func (u *UserAuthControl) GetWxToken(ctx context.Context, r *pb.GetWxTokenReq, w *pb.GetWxTokenRsp) error {
	defer utils.Logf(ctx, "GetWxToken", r)(w)
	return ao.GetWxToken(ctx, r, w)
}
